Search Results

Search found 4 results on 1 pages for 'syb'.

Page 1/1 | 1 

  • lists searches in SYB or uniplate haskell

    - by Chris
    I have been using uniplate and SYB and I am trying to transform a list For instance type Tree = [DataA] data DataA = DataA1 [DataB] | DataA2 String | DataA3 String [DataA] deriving Show data DataB = DataB1 [DataA] | DataB2 String | DataB3 String [DataB] deriving Show For instance, I would like to traverse my tree and append a value to all [DataB] So my first thought was to do this: changeDataB:: Tree -> Tree changeDataB = everywhere(mkT changeDataB') chanegDataB'::[DataB] -> [DataB] changeDataB' <add changes here> or if I was using uniplate changeDataB:: Tree -> Tree changeDataB = transformBi changeDataB' chanegDataB'::[DataB] -> [DataB] changeDataB' <add changes here> The problem is that I only want to search on the full list. Doing either of these searches will cause a search on the full list and all of the sub-lists (including the empty list) The other problem is that a value in [DataB] may generate a [DataB], so I don't know if this is the same kind of solution as not searching chars in a string. I could pattern match on DataA1 and DataB3, but in my real application there are a bunch of [DataB]. Pattern matching on the parents would be extensive. The other thought that I had was to create a data DataBs = [DataB] and use that to transform on. That seems kind of lame, there must be a better solution.

    Read the article

  • understanding syb boilerplate elimination

    - by Pradeep
    In the example given in http://web.archive.org/web/20080622204226/http://www.cs.vu.nl/boilerplate/ -- Increase salary by percentage increase :: Float -> Company -> Company increase k = everywhere (mkT (incS k)) -- "interesting" code for increase incS :: Float -> Salary -> Salary incS k (S s) = S (s * (1+k)) how come increase function compiles without binding anything for the first Company mentioned in its type signature. Is it something like assigning to a partial function? Why is it done like that?

    Read the article

  • AnimationDrawable, when does it end?

    - by Syb
    I know there have been several people with the same question. Which is: How do i know when a frame by frame animation has ended? I have not had any useful answer on fora i visited. So i thought, let's see if they know at stackoverflow. But I could not sit still in the mean time, so i made a work around of this, but it does not really work the way i would like it to. here is the code: public class Main extends Activity { AnimationDrawable sybAnimation; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); ImageView imageView = (ImageView)findViewById(R.id.ImageView01); imageView.setBackgroundResource(R.anim.testanimation); sybAnimation = (AnimationDrawable) imageView.getBackground(); imageView.post(new Starter()); } class Starter implements Runnable { public void run() { sybAnimation.start(); long totalDuration = 0; for(int i = 0; i< sybAnimation.getNumberOfFrames();i++){ totalDuration += sybAnimation.getDuration(i); } Timer timer = new Timer(); timer.schedule(new AnimationFollowUpTimerTask(R.id.ImageView01, R.anim.testanimation_reverse),totalDuration); } } class AnimationFollowUpTimerTask extends TimerTask { private int id; private int animationToRunId; public AnimationFollowUpTimerTask(int idOfImageView, int animationXML){ id = idOfImageView; animationToRunId = animationXML; } @Override public void run() { ImageView imageView = (ImageView)findViewById(id); imageView.setBackgroundResource(animationToRunId); AnimationDrawable anim = (AnimationDrawable) imageView.getBackground(); anim.start(); } } basically I make a timertask which is scheduled with the same time as the animation to take. In that run() I want to load a new animation into the imageView and start that animation, this however does not work. Does anyone know how to get this to work, or even better, have a better way to find out when an AnimationDrawable has ended its animation?

    Read the article

  • prefix + and - to divs using jquery.

    - by pradeep
    i have jquery accordion script like this.. <script type='text/javascript'> $(document).ready(function() { $('div.Syb> div').hide(); $('div.Syb> h4').click(function() { $(this).next('div').slideToggle('fast') .siblings('div:visible').slideUp('fast'); }); }); </script> i need to show + and - symbol before the div ..to show that its expanded and collapsed.. how do i do it.?

    Read the article

1